var t = getApp();

Page({
    data: {
        name: "",
        img: "",
        mid: "",
        title: "",
        fromGood: "",
        is_bind_invite: 0
    },
    onLoad: function(t) {
        t.fromGood && this.setData({
            fromGood: t.fromGood
        }), wx.hideHomeButton();
    },
    onReady: function() {},
    onShow: function() {
        this.getUserinfo(), this.showName();
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    getUserinfo: function() {
        var e = this, o = "";
        try {
            var a = wx.getStorageSync("mid");
            a && (o = a);
        } catch (t) {}
        var i = t.getNetAddresss("member.member.getUserInfo");
        t._getNetWork({
            url: i,
            data: {
                mid: o
            },
            validateBol: 2,
            success: function(t) {
                var o = t.data;
                1 == o.result && e.setData({
                    name: o.data.referral.nickname,
                    img: o.data.referral.avatar,
                    is_bind_invite: o.data.is_bind_invite,
                    inviteCode: o.data.inviteCode
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    showName: function() {
        var e = this, o = t.getNetAddresss("member.member.getShopSet");
        t._getNetWork({
            url: o,
            data: {},
            validateBol: 2,
            success: function(t) {
                var o = t.data;
                1 == o.result ? e.setData({
                    title: o.data.shop_set_name,
                    default_invite: o.data.default_invite
                }) : wx.showToast({
                    icon: "none",
                    title: o.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    affirm: function() {
        try {
            wx.setStorageSync("isset", 1);
        } catch (t) {
            console.log(t);
        }
        if (1 == this.data.fromGood) {
            var e = t.getNetAddresss("member.member.confirmGoods");
            t._getNetWork({
                url: e,
                data: {},
                success: function(t) {
                    var e = t.data;
                    1 == e.result ? wx.navigateBack({
                        delta: 1
                    }) : wx.showToast({
                        icon: "none",
                        title: e.msg,
                        duration: 1500
                    });
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        } else wx.navigateTo({
            url: "/packageA/member/editmobile/editmobile?fromApp=3&code=" + this.data.inviteCode
        });
    },
    error: function(t) {
        try {
            wx.setStorageSync("isset", 1);
        } catch (t) {
            console.log(t);
        }
        this.data.fromGood ? wx.navigateTo({
            url: "/packageC/member/visit/InputVisit/InputVisit?fromGood=" + this.data.fromGood
        }) : wx.navigateTo({
            url: "/packageC/member/visit/InputVisit/InputVisit"
        });
    }
});